#include <iostream>

using std::cout;
using std::endl;

void test0()
{
    int arr[5] = {1, 2, 3, 4, 5};
    //数组名无法赋值，也是一个常量
    //arr = 100;
    cout << "arr:" << arr << endl;
    cout << "&arr:" << &arr << endl;

    int * p1 = arr;
    cout << "*p1:" << *p1 << endl;
    cout << "*(p1 + 1):" << *(p1 + 1) << endl;
    
    //int (*)[5]    数组指针
    int (* p2)[5] = &arr;
    cout << "**p2:" << *(*p2) << endl;
    cout << "*(p2 + 1):"<< *(p2+1) << endl;
}

void test1()
{
    int num1 = 1, num2 = 2, num3 = 3;
    //指针数组
    int * arr[3] = {&num1, &num2, &num3};

    for(int i = 0; i < 3; ++i) {
        cout << arr[i] << ":" << *arr[i] << endl;
    }
}

int main()
{
    /* test0(); */
    test1();
    return 0;
}

